<!-- head -->
{include file='public/head' /}
<!-- head -->

<!-- left -->
{include file='public/left' /}
<!-- left -->

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            管理后台
            <small>1.0.0</small>
        </h1>
        <ol class="breadcrumb">
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-default">
                    <div class="box-header with-border">
                        <h3 class="box-title">网站配置</h3>
                    </div>
                    <form class="form-horizontal" id="form" action="{:url('admin/config/postsave','','')}">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="title" class="col-sm-2 control-label">网站标题</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="title" name="title" placeholder="网站标题" value="{$row.title}">
                                    <span class="help-block" style="color:#f00;"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="keywords" class="col-sm-2 control-label">网站关键词</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="keywords" name="keywords" placeholder="网站关键词" value="{$row.keywords}">
                                    <span class="help-block" style="color:#f00;"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="description" class="col-sm-2 control-label">网站描述</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="description" name="description" placeholder="网站描述" value="{$row.description}">
                                    <span class="help-block" style="color:#f00;"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="copyright" class="col-sm-2 control-label">网站版权</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="copyright" name="copyright" placeholder="网站版权" value="{$row.copyright}">
                                    <span class="help-block" style="color:#f00;"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="beian" class="col-sm-2 control-label">备案号</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="beian" name="beian" placeholder="备案号" value="{$row.beian}">
                                    <span class="help-block" style="color:#f00;"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="intro" class="col-sm-2 control-label">网站介绍</label>
                                <div class="col-sm-10">
                                    <textarea class="form-control" id="intro" name="intro" placeholder="网站介绍">{$row.intro}</textarea>
                                    <span class="help-block" style="color:#f00;"></span>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer" style="text-align:right;">
                            <button type="button" class="btn btn-sm btn-default" id="resetForm">清空</button>&nbsp;
                            <button type="button" class="btn btn-sm btn-primary" id="saveForm">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->

<script src="__STATIC__/kindeditor/kindeditor-all-min.js" type="text/javascript"></script>
<script src="__STATIC__/kindeditor/lang/zh-CN.js" type="text/javascript"></script>
<script type="text/javascript">
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('#intro', {
            minHeight: 200,
            resizeType : 1,
        });
    });
</script>

<script type="text/javascript">

    $(function(){

        $('#saveForm').click(function(){

            var title = $.trim($('#title').val());
            var keywords = $.trim($('#keywords').val());
            var description = $.trim($('#description').val());
            var copyright = $.trim($('#copyright').val());
            var beian = $.trim($('#beian').val());

            editor.sync();
            var intro = $('#intro').val();

            $.ajax({
                url: $('#form').attr('action'),
                type: 'POST',
                data: {
                    'title': title,
                    'keywords': keywords,
                    'description': description,
                    'copyright': copyright,
                    'beian': beian,
                    'intro': intro,
                },
                dataType: 'JSON',
                success: function(data) {
                    if (data.status == 1) {
                        showAlert('提示', data.info, null);
                    } else {
                        showAlert('提示', data.info, null);
                    }
                }
            });
        });

    });

</script>

<!-- right -->
{include file='public/right' /}
<!-- right -->

<!-- foot -->
{include file='public/foot' /}
<!-- foot -->
